#ifndef __DEV_H
#define __DEV_H
#include "stm32f10x.h"                  // Device header
#include "def.h"
//USART2
void USART2_Init(u32 bound);

//USART3
void USART3_Init(u32 bound);
void USART3_DMA_SendString(u8 *str,u16 len);
void USART3_SendString(u8 *Data,u16 len);

void U3_Configuration(uint32_t Baudrate);
void U3_DMA_Init(void);
void U3_SendString(u8 *Data,u16 len);

//ESP
void ESP_Init(void);
int ESP_StartXmit(void);
int ESP_Wait(char *wait,u16 timeout);
int ESP_WaitDup(char* wait1,char* wait2,u16 timeout);

//OLED
#define OLED_CS		PAout(11)		//CS=PA11
#define OLED_RST	PAout(10)		//RST=PA10
#define OLED_DC		PAout(9)		//D/C=PA9
#define OLED_SCLK	PAout(8)		//SCLK=PA8
#define OLED_SDIN	PBout(12)		//SDIN=PB12
#define OLED_CMD  0	//write cmd
#define OLED_DATA 1	//write data
void OLED_Init(void);
void OLED_Refresh_Gram(void);
void OLED_ShowString(u8 x,u8 y,const u8 *p,u8 size);

//TIM
void TIM2_Init(void);

//IWDG
void IWDG_Init(void);
void IWDG_Feed(void);

#endif
